package model;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Dustin
 */
public class ComputerPlayer extends Player {

    public ComputerPlayer(String aName) {
        super(aName);
    }

    public void doTurn(Game g) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException ex) {
            Logger.getLogger(ComputerPlayer.class.getName()).log(Level.SEVERE, null, ex);
        }
        double choice = Math.random();
        if(choice < 0.1) {
            System.out.println(getName() + " pass");
            pass(g);
        } else if(choice < 0.9) {
            System.out.println(getName() + " swap");
            swapCard(g.getTable(), (int) Math.random() * HAND_SIZE,
                    (Math.random() < 0.8 ? (int) (Math.random() * HAND_SIZE) : Table.AMOUNT_OF_TABLE_CARDS - 1));
        } else if(choice >= 0.9){
            System.out.println(getName() + " swap all");
            swapCards(g);
        }
    }
}
